﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Lesson12 : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        InputField input = this.GetComponent<InputField>();
        Debug.LogFormat(input.text);
        input.text = "代码控制：Hello World...";

        #region 监听事件
        //输入变化
        input.onValueChange.AddListener((str)=>
        {
            Debug.LogFormat("代码监听 改变 str:{0}", str);
        });
        //结束输入
        input.onEndEdit.AddListener((str)=>
        {
            Debug.LogFormat("代码监听 结束输入 str:{0}", str);
        });
        #endregion

    }

    public void ChangeInput(string str)
    {
        Debug.LogFormat("ChangeInput str:{0}", str);
    }

    public void EndInput(string str)
    {
        Debug.LogFormat("EndInput str:{0}", str);
    }
}
